package cn.tedu.csmall.product.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.nio.file.Watchable;

/**
 * @author liyang
 * @version 1.0
 * @package cn.tedu.csmall.product.config
 * @file WebMvcConfiguration.java
 * @description
 * @time 2024/9/22 下午5:55
 */
@Slf4j
@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {
    /*快捷键addcors*/
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        /*允许跨域,星号表随意*/
        registry.addMapping("/**")
                .allowedOriginPatterns("*")
                .allowedHeaders("*")
                .allowedMethods("*")
                .allowCredentials(true)
                .maxAge(3600);



    }
}
